package com.sogoodsoft.service.crm;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.sogoodsoft.dao.common.CommonHibernateDao;
import com.sogoodsoft.dao.crm.DocFileDao;
import com.sogoodsoft.entity.crm.DocFile;
import com.sogoodsoft.service.common.AbstractService;

@Component
public class DocFileService extends AbstractService < DocFile, Long > {

    @Autowired
    private DocFileDao docFileDao;
    
    @Override
    public CommonHibernateDao < DocFile, Long > getDao() {
        return docFileDao;
    }
    
    /**
     * 通过文档的docId,得到相关的附件列表
     * @param docId
     * @return
     */
    public List<DocFile> getDocFiles(Long docId){
        return docFileDao.getDocFiles(docId);
    }
    
    /**
     * 删除文档docId对应的附件
     * @param docId
     */
    public void deleteByDocId(Long docId){
        docFileDao.deleteByDocId(docId);
    }

}
